﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using System.Data;
using Husb.Data;
using Husb.Util;
using CentralOffice.Archive.Data;
using CentralOffice.Archive.DataAccess;

using CategoryTable = CentralOffice.Archive.Data.CategoryDataSet.CategoryDataTable;
using CategoryRow = CentralOffice.Archive.Data.CategoryDataSet.CategoryRow;

namespace CentralOffice.Archive.BusinessActions
{
    public class ArchiveCategory : DataAccessManager<CategoryDataSet, CategoryTable, CategoryRow, ArchiveCategoryAdapter>
    {
        public static CategoryTable GetAllWithEmpty()
        {
            ArchiveCategoryAdapter adapter = new ArchiveCategoryAdapter();
            CategoryTable table = adapter.GetAll();

            CategoryTable t = new CategoryTable();

            CategoryRow row = t.NewCategoryRow();
            row.Id = Guid.Empty;
            row.Name = "请选择...";

            row.CreatedBy = Guid.Empty;
            row.CreatedTime = DateTime.Now;
            row.Description = "";
            row.IsActive = true;
            row.IsDeleted = false;
            row.LastModifiedBy = Guid.Empty;
            row.ModifiedTime = DateTime.Now;
            row.Version = 1;

            t.AddCategoryRow(row);

            foreach (CategoryRow r in table)
            {
                t.ImportRow(r);
            }

            

            return t;
        }
    }
}
